const { userInputNotFound, ooMandatoryParametersError } = require("../main/err.type");

const VerifyCreatePeopleInput = async (ctx, next) => {
    console.log(ctx.request.body);
    if (!ctx.request.body) {
        ctx.body = userInputNotFound;
        return ctx.app.emit("error", userInputNotFound, ctx);
    }
    const { name, sex, birth, phone, political, education } = ctx.request.body;
    if (!name || sex==null || !birth || !phone || !political || !education) {
        ctx.body = ooMandatoryParametersError;
        return ctx.app.emit("error", ooMandatoryParametersError, ctx);
    } else {
        await next();
    }
};
module.exports = {
    VerifyCreatePeopleInput,
};
